home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11040 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  905 b 

  1. Path: lrz-muenchen.de!news
  2. From: watzka@stat.uni-muenchen.de (Kurt Watzka)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Rand() Function
  5. Date: 21 Mar 1996 16:09:49 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4irv0d$4mq@sparcserver.lrz-muenchen.de>
  9. References: <4iqltj$40g@news1.sympatico.ca>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. Gisele Swinson <gisele.swinson@sympatico.ca> writes:
  13.  
  14. >How do I get a random number from a "SET" of numbers.
  15.  
  16. >e.g.
  17.  
  18. >      I want a random number from this set:
  19.  
  20. >      2, 4, 6, 8, 10
  21.  
  22. >It seems so simple but I can't find anything in my text how to do this.
  23.  
  24. Step 1: Get a random number from {0, 1, 2, 3, 4}. The FAQ explains how
  25.         to do this.
  26. Step 2: Add One.
  27. Step 3: Multiply by 2.
  28.  
  29. Kurt
  30. --
  31. | Kurt Watzka                             Phone : +49-89-2180-6254
  32. | watzka@stat.uni-muenchen.de
  33. | ua302aa@sunmail.lrz-muenchen.de
  34.  
  35.